//
//  WMBMSAnalytics.h
//  AFNetworking
//
//  Created by zero on 2020/7/16.
//

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

typedef NS_ENUM(NSUInteger, WMBMSUserBehaviorType) {
    WMBMSUserBehaviorTypeUserLogin, /// 活跃用户统计
    WMBMSUserBehaviorTypeAdAppid, /// 获取下发配置-广告AppID
    WMBMSUserBehaviorTypeBaseInstall, /// 用户安装后首次进入应用
    WMBMSUserBehaviorTypeBaseJson, /// 获取下发配置-是否打开隐私协议/实名认证
    
    WMBMSUserBehaviorTypeBasePrivacyShow, /// 隐私弹窗显示
    WMBMSUserBehaviorTypeBasePrivacyClick, /// 隐私弹窗操作
    WMBMSUserBehaviorTypeBasePermission, /// 权限获取结果
    
    WMBMSUserBehaviorTypeBaseGameStart, /// 用户进入游戏
    
    WMBMSUserBehaviorTypeATTShow, /// 授权弹窗展示
    WMBMSUserBehaviorTypeATTAllow, /// 授权弹窗点击允许
    WMBMSUserBehaviorTypeATTNotAllow, /// 授权弹窗不允许
    
    
    WMBMSUserBehaviorTypeRealnameJson, /// 实名认证配置
    
    WMBMSUserBehaviorTypeRealnameShow, /// 实名认证说明弹窗展示
    WMBMSUserBehaviorTypeRealnameClick, /// 实名认证说明弹窗展示
    
    WMBMSUserBehaviorTypeRealnameInfoShow, /// 实名认证弹窗展示
    WMBMSUserBehaviorTypeRealnameInfoClick, /// 实名认证弹窗点击提交
    WMBMSUserBehaviorTypeRealnameInfoClose, /// 实名认证弹窗点击暂不认证
    
    WMBMSUserBehaviorTypeRealnameVerifySuccess, /// 实名认证弹窗校验成功
    WMBMSUserBehaviorTypeRealnameVerifyFail, /// 实名认证弹窗校验失败
    
    WMBMSUserBehaviorTypeRealnameApi, /// 实名认证调用正式接口
    
    WMBMSUserBehaviorTypeMinorsShow, /// 未成年人提醒弹窗展示
    WMBMSUserBehaviorTypeMinorsClick, /// 未成年人提醒弹窗点击
    
    WMBMSUserBehaviorTypeAntiaddictionShow, /// 防沉迷弹窗展示
    WMBMSUserBehaviorTypeAntiaddictionClick, /// 防沉迷弹窗点击
    
    WMBMSUserBehaviorTypeNotificationCall, /// 调用通知弹窗
    WMBMSUserBehaviorTypeNotificationShow, /// 通知弹窗展示
    WMBMSUserBehaviorTypeNotificationClick, /// 通知弹窗操作
};

typedef NS_ENUM(NSUInteger, WMBMSUserPurchaseType) {
    WMBMSUserPurchaseTypePurchaseItemShow, /// 商品展示
    WMBMSUserPurchaseTypePurchaseItemClick, /// 商品点击
    WMBMSUserPurchaseTypePurchaseItemSold, /// 游戏发货
    
    WMBMSUserPurchaseTypePurchaseShow, /// 付款弹窗展示
    WMBMSUserPurchaseTypePurchaseSuccess, /// 购买成功
    WMBMSUserPurchaseTypePurchaseFail, /// 购买失败
    WMBMSUserPurchaseTypePurchaseCancel, /// 取消购买
    
    WMBMSUserPurchaseTypePurchaseVerifySuccess, /// 服务器校验成功
    WMBMSUserPurchaseTypePurchaseVerifyFail, /// 服务器校验失败
    
    WMBMSUserPurchaseTypePurchaseRestoreClick, /// 恢复购买入口点击
    WMBMSUserPurchaseTypePurchaseRestoreNoneOrder, /// 没有恢复购买的订单
    WMBMSUserPurchaseTypePurchaseRestoreSuccess, /// 恢复购买成功
    WMBMSUserPurchaseTypePurchaseRestoreFail, /// 恢复购买失败
};

typedef NS_ENUM(NSUInteger, WMBMSAdvertisingBehaviorType) {
    WMBMSAdvertisingBehaviorTypeAdRequest, /// 广告请求
    WMBMSAdvertisingBehaviorTypeAdFill, /// 广告填充
    WMBMSAdvertisingBehaviorTypeAdImpression, /// 广告展示
    WMBMSAdvertisingBehaviorTypeAdClick, /// 广告点击
    WMBMSAdvertisingBehaviorTypeRequestAll, /// 广告触发
};

typedef NS_ENUM(NSUInteger, WMBMSAdvertisingType) {
    WMBMSAdvertisingTypeNoPlatform = 0,
    WMBMSAdvertisingTypeFeed, /// 信息流广告
    WMBMSAdvertisingTypeBanner, /// banner广告
    WMBMSAdvertisingTypeSplash, /// 开屏广告
    WMBMSAdvertisingTypeRewarded, /// 激励视频广告
    WMBMSAdvertisingTypeFull, /// 插屏广告
};

typedef NS_ENUM(NSUInteger, WMBMSAdvertisingPlatformType) {
    WMBMSAdvertisingPlatformTypeNoPlatform = 0,
    WMBMSAdvertisingPlatformTypeGDT, /// 广点通
    WMBMSAdvertisingPlatformTypeBU, /// 穿山甲
    WMBMSAdvertisingPlatformTypeMTG, /// MTG
    WMBMSAdvertisingPlatformTypeKS, /// 快手
    WMBMSAdvertisingPlatformTypeAdMob, /// admob
    
    WMBMSAdvertisingPlatformTypeVungle = 7, /// Vungle
    WMBMSAdvertisingPlatformTypeKlein = 8, /// 游可赢
    WMBMSAdvertisingPlatformTypeBaidu = 9, /// 百度
    WMBMSAdvertisingPlatformTypeSigmob = 10, /// Sigmob
    WMBMSAdvertisingPlatformTypeInmobi = 11, /// Inmobi
    WMBMSAdvertisingPlatformTypeUnity = 12, /// Inmobi
};
 
 
@interface WABMSAnalytics : NSObject

+ (instancetype)shareInstance;

/// 初始化国内统计SDK
/// @param appName BMS AppName
/// @param channel BMS AppChannel
/// @param hasPrivacy 是否携带了隐私协议，如果携带了，Att弹窗需要自己手动调用
- (void)setupAnalyticsWithAppName:(NSString *)appName channel:(NSString *)channel hasPrivacy:(BOOL)hasPrivacy;


/// 获取用户UUID，如果有隐私协议，需要在同意隐私协议后调用，如果没有，会自动在初始化时调用
- (void)getServerUUID;

/// 获取网络配置
/// @param handle 里面包含 隐私&用户协议地址
- (void)getNetworkConfig:(void(^)(BOOL status, NSDictionary *dicData))handle;


/// 展示Att页面
/// @param showBlock 是否显示
/// @param agreeBlock 是否同意
- (void)showAttViewisShow:(void(^)(BOOL isShow))showBlock isAgree:(void(^)(BOOL isAgree, NSString *idfaString))agreeBlock;


/// 添加用户行为数据
/// @param type 用户行为类型
/// @param adt 广告类型
/// @param tab1 参数1
/// @param tab2 参数2
- (void)addUserBehaviorLogWithType:(WMBMSUserBehaviorType)type ADT:(NSString *)adt TAB1:(NSString *)tab1 TAB2:(NSString *)tab2;


/// 添加用户操作数据
/// @param wds 操作内容
/// @param act 操作类型
/// @param tab1 参数1
/// @param tab2 参数2
/// @param tablist 参数数组 @[参数3, 参数4, ...]
- (void)addUserOperationLogWithWds:(NSString *)wds Act:(NSString *)act Tab1:(NSString *)tab1 Tab2:(NSString *)tab2 TabList:(NSArray *)tablist;


/// 添加一条内购数据
/// @param purchaseType 事件类型
/// @param pid 商品ID
/// @param pdt 商品标题
/// @param pdn 商品名称
/// @param odn 订单id
/// @param tablist 参数列表 @[参数1, 参数2, ....]
- (void)addInternalPurchaseLogWithPurchaseType:(WMBMSUserPurchaseType)purchaseType Pid:(NSString *)pid Pdt:(NSString *)pdt Pdn:(NSString *)pdn Odn:(NSString *)odn TabList:(NSArray *)tablist;


/// 将广告平台类型转换成字符串
/// @param platformType 广告平台类型
- (NSString *)changeAdPlatformToStringWithPlatformType:(WMBMSAdvertisingPlatformType)platformType;


/// 添加广告行为数据
/// @param adBehaviorType 广告行为类型
/// @param adt 广告类型
/// @param tab1 参数1
/// @param tab2 参数2
/// @param tablist 参数数组 @[参数3, 参数4, ...]
- (void)addAdvertisingBehaviorLogWithAdBehaviorType:(WMBMSAdvertisingBehaviorType)adBehaviorType AdT:(WMBMSAdvertisingType)adt tab1:(NSString *)tab1 tab2:(NSString *)tab2 TabList:(NSArray *)tablist;


@end

NS_ASSUME_NONNULL_END
